<?php
$items = $this->tables['procedure'];
include 'include_pagerform.php';
?>
<div class="pageHeader">
    <form onsubmit="return dwzSearch(this, 'dialog');" action="<?= $this->action ?>" method="post">
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>名称查找：</td>
                    <td><input type="text" name="keyword" /></td>
                    <td>所属分类：</td>
                    <td>
                        <select class="combox required" name="province">
                            <option value="">显示所有分类</option>
                        </select>
                    </td>
                    <td>
                        <div class="subBar">
                            <ul>
                                <li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
                                <li><a class="button" href="demo_page6.html" target="dialog" mask="true" title="查询框"><span>高级检索</span></a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
            </table>

        </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <?php
            $viewnameid = isset($this->search['procedure.viewnameid']) ? '&viewnameid=' . $this->search['procedure.viewnameid'] : '';
            ?>
            <li><a class="add" width="530" height="350" href="?c=sys_procedure&a=add&menuitemid=<?= $this->search['procedure.menuitemid'] ?>&parentid=<?= $this->search['procedure.parentid'] . $viewnameid ?>" target="dialog" rel="sys_procedure_add"><span>在末尾添加</span></a></li>
            <li><a class="add" width="530" height="350" href="?c=sys_procedure&a=add&menuitemid=<?= $this->search['procedure.menuitemid'] ?>&parentid=<?= $this->search['procedure.parentid'] . $viewnameid ?>&nextid={id}" target="dialog" rel="sys_procedure_add"><span>插入到之上</span></a></li>
            <!--<li><a class="delete" href="demo/common/ajaxDone.html?uid={sid_user}" target="ajaxTodo" title="确定要删除吗?"><span>删除</span></a></li>-->
            <li><a class="edit" href="?c=sys_procedure&a=edit&id={id}" target="dialog"><span>修改</span></a></li>
            <li><a class="delete" href="/index.php/BaseData/delete" target="selectedTodo" rel="ids" postType="string" title="确实要删除这些记录吗?"><span>批量删除</span></a></li>
            <!--
            <li class="line">line</li>
            <li><a class="icon" href="demo/common/dwz-team.xls" target="dwzExport" targetType="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li>
            -->
        </ul>
    </div>
    <table class="table" width="100%" layoutH="116">
        <thead>
            <tr align="center">
                <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th>ID</th>
                <th>状态</th>
                <th>代码类型</th>
                <th>操作内容</th>
                <th>赋值到变量</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <?
            foreach ($items as $row) {
                $proctext = json_decode($row['proctext'], true);
                ?>
                <tr target="id" rel="<?= $row['id'] ?>" align="center">
                    <td><input name="ids" value="6" type="checkbox"></td>
                    <td><?= $row['id'] ?></td>
                    <td><?
            if ($row['del_time'] != 0) {
                echo '<font color="red">已删除</font>';
            } else if ($row['enable']) {
                echo '<font color="green">生效</font>';
            } else {
                echo '<font color="#999999">失效</font>';
            }
                ?>
                    </td>
                    <td><?= $row['typename'] ?></td>
                    <td><?= $row['title'] ?></td>
                    <td><?= isset($proctext['assignvarname']) ? $proctext['assignvarname'] : '-' ?></td>
                    <td>
                        <a target="ajaxTodo" href="?c=sys_procedure&a=del&parentid=<?= $this->search['procedure.parentid'] ?>&id=<?= $row['id'] ?>" class="btnDel" title="确定要删除吗?">删除</a>
                        <a href="?c=sys_procedure&a=edit&menuitemid=<?= $this->search['procedure.menuitemid'] ?>&parentid=<?= $this->search['procedure.parentid'] ?>&id=<?= $row['id'] ?>" class="btnEdit" rel="sys_procedure_info" target="dialog" width="530" height="350">编辑代码</a>
                        <?
                        $havesub = 'if,elseif,else,for,switch';
                        if (strstr(',' . $havesub . ',', ',' . $row['typename'] . ',')) {
                            ?>
                            <a href="?c=sys_procedure&a=list&search[procedure.menuitemid]=<?= $this->search['procedure.menuitemid'] ?>&search[procedure.parentid]=<?= $row['id'] ?>" class="btnInfo" rel="sys_procedure_list_<?= $row['id'] ?>" !target="dialog" target="navTab" width="650" height="350">代码子集列表</a>
                            <?
                        }
                        ?>
                    </td>
                </tr>
            <? } ?>
        </tbody>
    </table>
    <?php
    include 'include_pagesbar.php';
    ?>
</div>
